{% extends "main.html" %} 

{% block title %}--{{post.title}}{% endblock %}

{% block blog %}
    <div id="postpath">
		<a title="Goto homepage" href="/">Home</a>
		 &gt; <a href="/category/{{post.catalog|unquote}}" rel="catalog tag">{{post.catalog|unquote}}</a>
		 &gt; {{post.title}}</div>
		<div class="post"> 
      <h2>{{post.title}}{%if post.private%}--private{%endif%}</h2>
      <div class="info">
				<span class="date">{{post.date|timezone:8|date:"l, M d H:i, Y"}}</span>
				<div class="act">
					<span class="comments">{{post.commentcount}} comments/{{post.hitcount}} hits</span>
				  <div class="fixed"></div>
				</div>
				<div class="fixed"></div>
			</div>
      <div class="content">{{post.content}}
      {%if post.lastModifiedDate %}
        <p style="background:#ddd">Last modified by {{post.lastModifiedBy}} -- {{post.lastModifiedDate|timezone:8|date:"Y-m-d h:i"}}</p>
      {%endif%}
      </div>
      <div class="under">
				<span class="author">Author: </span><span>{{post.author}}</span>
				<span class="categories">Categories: </span>
				<span><a href="/category/{{post.catalog|unquote}}" rel="category tag">{{post.catalog|unquote}}</a></span>
				<span class="tags">Tags: </span>{% if post.tags %}        
        <span>
          {% for tag in post.tags %}
          <a href="/tag/{{tag|unquote}}">{{ tag|unquote }}</a>{% if not forloop.last %},&nbsp;{% endif %}
          {% endfor %}        
        </span>
        {% endif %}
			  {% if user_is_admin %}			  
          <div style="float:right"><a href='/edit/{{post.key.id}}'><span class="editpost">edit</span></a><a href='/delete/{{post.key.id}}'><span class="readingblinds">delete</span></a></div>
        {% endif %} 
      </div>
      		  </div>
      <div id="comments">
        <div id="cmtswitcher">
    			<a id="commenttab" class="curtab" href="javascript:void(0);" onclick="MGJS.switchTab('thecomments,commentnavi', 'thetrackbacks', 'commenttab', 'curtab', 'trackbacktab', 'tab');">Comments ({{post.commentcount}})</a>
    			<a id="trackbacktab" class="tab" href="#">Trackbacks (0)</a>
				  <span class="addcomment"><a href="#respond">Leave a comment</a></span>
				  <span class="addtrackback"><a href="#">Trackback</a></span>
		      <div class="fixed"></div>
		    </div>
		    <div id="commentlist">
	<!-- comments START -->
	<ol style="display: block;" id="thecomments">
	{%for comment in comments%}
	<li class="comment {%if comment.author_is_admin %}admincomment{%else%}regularcomment{%endif%}" id="comment-{{comment.key.id}}">
		<div class="author">
			<div class="pic">
				<img alt="avator" src="{{comment.authorEmail|gravatar}}" class="avatar avatar-32 photo" width="32" height="32" /></div>
			<div class="name">
			  {%if comment.authorWebsite%}
				<a id="commentauthor-{{comment.key.id}}" class="url" href="http://{{comment.authorWebsite|trimleadinghttp}}" rel="external nofollow">{{comment.author}}</a>
				{%else%}
				<span id="commentauthor-{{comment.key.id}}">{{comment.author}}</span>
				{%endif%}
		  </div>
		</div>
		<div class="info">
			<div class="date">
				{{comment.date|timezone:8|date:"Y-m-d H:i:s"}} | <a href="#comment-{{comment.key.id}}">#{{forloop.revcounter}}</a>
			</div>
			<div class="act">
			  {%if user_is_admin%}<a href="/delcomment/{{comment.key.id}}"> Delete</a> | {%endif%}
				<a href="javascript:void(0);" onclick="MGJS_CMT.reply('{{post.key.id}}', '{{comment.key.id}}', 'comment');">Reply</a> | 
				<a href="javascript:void(0);" onclick="MGJS_CMT.quote('{{post.key.id}}', '{{comment.key.id}}', 'comment');">Quote</a>
			</div>
			<div class="fixed"></div>
			<div class="content">				
				<div id="commentbody-{{comment.key.id}}">
					{{comment.content}}
				</div>
			</div>
		</div>
		<div class="fixed"></div>
	</li>
	{%endfor%}
	<li></li>
	</ol>
  </div>
	<form action="/addcomment?post_id={{post.key.id}}" method="post" onsubmit="return parseCommentContent()" id="commentform">
	<div id="respond">
			<div id="author_info">
				<div class="row">
					<input name="comm_name" id="author" class="textfield" value="{{comm_name}}" size="24" tabindex="1" type="text" />
					<label for="author" class="small">Name (required)</label>
				</div>
				<div class="row">
					<input name="comm_email" id="email" class="textfield" value="{{comm_email}}" size="24" tabindex="2" type="text" />
					<label for="email" class="small">E-Mail (will not be published) (required)</label>
				</div>
				<div class="row">
					<input name="comm_url" id="url" class="textfield" value="{{comm_url}}" size="24" tabindex="3" type="text" />
					<label for="url" class="small">Website</label>
				</div>
				<div class="row">
					<span id="gnmhjgjtyt"></span> = <input name="sdfafwba" id="sdfafwba" class="textfield" size="24" tabindex="4" type="text" />
					<label for="sdfafwba" class="small">Type result here</label>
				</div>
				<input type="hidden" id="sdamwegmw" name="sdamwegmw" value="0" />
			</div>
		<!-- comment input -->
		<div class="row">
			<textarea name="comment" id="comment" tabindex="4" rows="8" cols="50"></textarea>
		</div>
		<!-- comment submit and rss -->
		<div id="submitbox">
			<a class="feed" href="http://www.neoease.com/comments/feed/">Subscribe to comments feed</a>
			<div class="submitbutton">
				<input name="submit" id="submit" class="button" tabindex="5" value="Submit Comment" type="submit" />
			</div>
			<div id="emoticon">
			  <script type="text/javascript" src="/static/js/emoticons.js"></script>
			  <a title="Pick an Emote" href="javascript:void(0);" class="highslide">emoticons</a>
			</div>
			<input name="comment_post_ID" value="856" type="hidden" />
			<div class="fixed"></div>
		</div>
	</div>
	</form>
	<script type="text/javascript">
  function parseCommentContent(){
    var author = document.forms["commentform"]["author"];
    if(author.value==""){
      alert("Please input your name.")
      author.focus();
      return false;
    }
    var email = document.forms["commentform"]["email"];
    if(email.value==""){
      alert("Please input your email address.")
      email.focus();
      return false;
    }
    var pattern = /([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)\.([0-9a-zA-Z_-]+)/;
    if (!pattern.test(email.value)){
      alert("Bad Email Address: " + email.value);
      email.focus();
      return false;
    }
    var sdfafwba = document.forms["commentform"]["sdfafwba"];
    if (sdfafwba.value != eval($('gnmhjgjtyt').innerHTML)){
      alert("Calculate then type result here!")
      sdfafwba.focus();
      return false;
    }else{
      $('sdamwegmw').value = "AfnGDASsdafSA";
    }
  }
  function loadsdfafwba(){
    var arg1 = Math.floor(Math.random() * 10)
    var arg2 = Math.floor(Math.random() * 10)
    $('gnmhjgjtyt').innerHTML = ''+arg1+' + '+arg2
  }
  </script>
  <script type="text/javascript" src="/static/js/comment.js"></script>
	<script type="text/javascript">MGJS.loadCommentShortcut();</script>
	<script type="text/javascript">loadsdfafwba()</script>

	<div id="postnavi">
		{%if prevp%}<span class="prev"><a href="{{prevp.full_permalink}}">{{prevp.title}}</a></span>{%endif%}
		{%if nextp%}<span class="next"><a href="{{nextp.full_permalink}}">{{nextp.title}}</a></span>{%endif%}
		<div class="fixed"></div>
	</div>
</div>
{% endblock %}  